<template>
  <el-form class="form-box" label-width="100px" label-position="right">
    <el-form-item label="自动去重设置">
      <el-select v-model="paramsObj.autoRemoveRepet" placeholder="请选择">
        <el-option
          v-for="item in removeRepetOption"
          :key="item.value"
          :label="item.label"
          :value="item.value"
          :title="item.label"
        />
      </el-select>
    </el-form-item>
    <el-form-item class="check-form-item">
      <el-checkbox v-model="paramsObj.isAutoPass" :true-label="1" :false-label="0">
        <span :style="{ fontWeight: paramsObj.isAutoPass ? 'bold': '' }" style="color:#666;font-size:14px;">审批中发起人自动通过</span>
      </el-checkbox>
    </el-form-item>
    <el-form-item label="加签人设置">
      <el-select v-model="paramsObj.countersignSet" placeholder="请选择">
        <el-option
          v-for="item in countersignSetOption"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        />
      </el-select>
    </el-form-item>
  </el-form>
</template>

<script>
import { FIXED_PROCESS_TYPE } from '@/utils/const/process';
export default {
  props: {
    processType: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      opeatorLoading: false,
      paramsObj: {
        isAutoPass: 0,
        autoRemoveRepet: 1,
        countersignSet: 1
      }
    };
  },
  computed: {
    countersignSetOption() {
      const { isFixed } = this.$route.query;
      if (!isFixed) {
        return [
          { value: 1, label: '添加加签人不限制' },
          { value: 3, label: '审批人不允许加签' }
        ];
      }
      if ([FIXED_PROCESS_TYPE.TERMINATION, FIXED_PROCESS_TYPE.ARREARS_TRANSFER, FIXED_PROCESS_TYPE.SIGN_UP].includes(this.processType)) {
        return [
          { value: 1, label: '添加加签人不限制' },
          { value: 3, label: '审批人不允许加签' }
        ];
      }
      return [
        { value: 1, label: '添加加签人不限制' },
        { value: 2, label: '申请人不允许加签' },
        { value: 3, label: '审批人不允许加签' }
      ];
    },
    removeRepetOption() {
      return [
        { value: 1, label: '同一个审批人仅在连续出现时，自动去重' },
        { value: 0, label: '不自动去重' }
      ];
    }
  },
  methods: {
    getData() {
      return _.cloneDeep(this.paramsObj);
    },
    setData(data) {
      this.paramsObj = data;
    }
  }
};
</script>

<style scoped lang="scss">
.form-box {
  & ::v-deep {
    .el-input__inner {
      width: 240px;
      height: 32px;
      line-height: 32px;
    }
    .el-textarea .el-textarea__inner{
      width: 610px;
      height: 120px;
    }
    .el-input__icon {
      line-height: 32px;
      height: 32px;
    }
    .el-form-item {
      margin-bottom: 24px;
    }
  }
}
</style>
